home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.3 Development Libraries / SGI IRIX 6.3 Development Libraries.iso / dist6.3 / gl_dev.idb / usr / include / sys / gro.h.z / gro.h
Encoding:
C/C++ Source or Header  |  1996-12-06  |  9.9 KB  |  318 lines

  1. #ifndef __SYS_GRO_H__
  2. #define __SYS_GRO_H__
  3.  
  4. /**************************************************************************
  5.  *                                      *
  6.  *          Copyright (C) 1990, Silicon Graphics, Inc.          *
  7.  *                                      *
  8.  *  These coded instructions, statements, and computer programs  contain  *
  9.  *  unpublished  proprietary  information of Silicon Graphics, Inc., and  *
  10.  *  are protected by Federal copyright law.  They  may  not be disclosed  *
  11.  *  to  third  parties  or copied or duplicated in any form, in whole or  *
  12.  *  in part, without the prior written consent of Silicon Graphics, Inc.  *
  13.  *                                      *
  14.  **************************************************************************/
  15.  
  16. #ident "$Revision: 1.18 $"
  17.  
  18. #include "sys/gfx.h"
  19.  
  20. /*
  21.  * Structure returned by ioctl GFX_GETBOARDINFO when executed on G graphics.
  22.  */
  23. struct g_info {
  24.     struct gfx_info gfx_info;     /* device independent information */
  25.     int bitplanes;            /* available bit planes */
  26.     int zplanes;            /* available Z-buffer bit planes */
  27. };
  28.  
  29. struct g_validatefocus_args {
  30.     long        rnid;
  31.     unsigned long    focus;
  32. };
  33.  
  34. struct g_setcursormode_args {
  35.     int    mode;
  36. };
  37.  
  38. struct g_setcursorcacheid_args {
  39.     int    cache_id;
  40. };
  41.  
  42. struct g_setcursorcolors_args {
  43.     int    colors[3];
  44. };
  45.  
  46. struct g_rtnbufbegin_args {
  47.         void *buffer;        /* user buffer virtual address */
  48.         int buflen;        /* length of buffer */
  49. };
  50.  
  51. struct g_rtnbufend_args {
  52.         int count;        /* feedback data count */
  53.         int overflow;            /* set if buffer length was insufficient */
  54. };
  55.  
  56. struct g_gsetmem_args {        /* G_SETMEM and G_GETMEM arguments */
  57.     long    offset;        /* offset into boards memory space */
  58.     char    *data;        /* pointer to data */
  59.     long    count;        /* count of data */
  60. };
  61.  
  62. struct g_download_args {    /* G_DOWNLOAD arguments */
  63.     long    offset;        /* offset into boards memory space */
  64.     long    count;        /* count of data */
  65.     char     *data;        /* pointer to data */
  66. };
  67.  
  68. struct g_run_args {        /* G_RUN/G_SIMPLERUN arguments */
  69.     long    pc;        /* initial pc */
  70.     short    water;        /* water mark for FE */
  71.     long    arg;        /* one argument */
  72. };
  73.  
  74. struct g_cgreg_args {        /* G_RCGREG / G_WCGREG arguments */
  75.     unsigned int reg;    /* register number */
  76.     unsigned char value;    /* value */
  77. };
  78.  
  79. struct g_setdisplaymode_args {
  80.        long int wid;
  81.     unsigned long int displaymode;
  82. };
  83.  
  84. /* Architecture dependent commands */
  85.  
  86. #define    G_SWITCHZERO        (GFX_PRIVATE_BASE+0)
  87. #define    G_FLUSHPIPE        (GFX_PRIVATE_BASE+1)
  88. #define G_RTNBUFBEGIN        (GFX_PRIVATE_BASE+2)
  89. #define G_RTNBUFEND        (GFX_PRIVATE_BASE+3)
  90. #define G_SETCURSORMODE        (GFX_PRIVATE_BASE+4)
  91. #define G_SETCURSORCACHEID    (GFX_PRIVATE_BASE+5)
  92. #define G_SETCURSORCOLORS    (GFX_PRIVATE_BASE+6)
  93. #define G_VALIDATEFOCUS        (GFX_PRIVATE_BASE+7)
  94. #define G_SETMEM        (GFX_PRIVATE_BASE+8)
  95. #define G_GETMEM        (GFX_PRIVATE_BASE+9)
  96. #define G_SETCRSTATE        (GFX_PRIVATE_BASE+10)
  97. #define G_GETCRSTATE        (GFX_PRIVATE_BASE+11)
  98. #define G_SIMPLERUN        (GFX_PRIVATE_BASE+12)
  99. #define G_RUN            (GFX_PRIVATE_BASE+13)
  100. #define G_DOWNLOAD        (GFX_PRIVATE_BASE+14)
  101. #define G_RDYTST        (GFX_PRIVATE_BASE+15)
  102. #define G_RESET            (GFX_PRIVATE_BASE+16)
  103. #define G_INTRGM        (GFX_PRIVATE_BASE+17)    /* interrupt GM */
  104. #define G_RCGREG        (GFX_PRIVATE_BASE+18)    /* read CG register */
  105. #define G_WCGREG        (GFX_PRIVATE_BASE+19)    /* write CG register*/
  106. #define G_SETDISPLAYMODE    (GFX_PRIVATE_BASE+20)
  107. #define G_DIAGMAPALL        (GFX_PRIVATE_BASE+21)
  108.  
  109. /* defines for the CG register */
  110. #define CG_MODE_REG        0
  111. #define CG_CONTROL_REG        1
  112. #define CG_HORPHASE_REG        2
  113. #define CG_SUBPHASE_REG        3
  114. #define CG_LASTREG        CG_SUBPHASE_REG
  115.  
  116.  
  117. #ifdef _KERNEL
  118. /*
  119.  * Defines for the "G" graphics option using the GF3 board
  120.  */
  121.  
  122. typedef struct    contextstate {
  123.     ushort *geaddr;            /* kernel virt addr of pipe head */
  124.     shmem_t *shmem;            /* kernel virt addr of user shared mem*/
  125.     sema_t waitsema;        /* synch semaphore for interrupt cmds */
  126.     int    waitflag;        /* state of interrupt request */
  127. } contextstate_t;
  128.  
  129. struct gro_data {
  130.     struct gfx_data    gfx_data;    /* device independent data */
  131.     struct g_info    info;        /* clover1 specific info */
  132.     ushort *csraddr;        /* pointer to CSR    */
  133.     void *memaddr;            /* pointer to on-board shared memory */
  134.     graphicsmgr_t    *gmaddr;    /* pointer to manager structure */
  135.     contextstate_t    *curcontext;    /* current context */
  136.     contextstate_t    *kernelcontext;    /* context for driver's use */
  137.     contextstate_t     contexts[MAXCONTEXTPERBOARD];
  138.     struct rrm_rnode *loadedpcxs[MAXCONTEXTPERBOARD];
  139.     int numcontexts;        /* number of currently assigned cxts */
  140.     int alive;            /* board can be talked to */
  141.     uint offset;            /* current microcode load offset */
  142.     int        timeoutcnt;    /* Number of times fifo timeout */
  143. };
  144.  
  145. /*
  146.  * Device DEPENDENT rendering node structure
  147.  */
  148. struct gro_rnode {
  149.     int dovalidateclip;
  150.     struct RRM_ValidateClip clip;
  151.  
  152.         /* user return buffer to copy out data at interrupt time */
  153.         void *rtnbufu;        /* user virtual address of buffer */
  154.         void *rtnbufk;        /* kernel virtual address of buffer */
  155.         long rtnbuflen;        /* buffer size (bytes) */
  156.         long rtnbufcount;    /* number bytes in buffer */
  157.         long rtnbufoverflow;    /* buffer overflowed  */
  158. };
  159.  
  160. /*
  161.  * address of base of pipe (note that it can be accessed in both
  162.  * A24 and A32 NP and S spaces. all new boards are in A32)
  163.  */
  164. #define GF3_PIPE_A32    0x18900000    /* base address of pipe */
  165. #define GF3_PIPE_SIZE    0x100000    /* 1 Meg pipe        */
  166.  
  167. /* Address of 1Meg of shared memory */
  168. #define GF3_SHMEM_A32    0x18800000    /* base address of shared mem */
  169. #define GF3_MEM_SIZE    0x100000    /* 1 Meg of dual ported memory    */
  170.  
  171. /* Control and Status register (in Short space) */
  172. #define GF3_CSR_A16    0x2002        /* read status write control */
  173.  
  174. #define GF3_SR_FEHW    0x8000        /* front-end fifo high water */
  175. #define GF3_SR_FELW    0x4000        /* front-end fifo low water */
  176. #define GF3_SR_FIHW    0x2000        /* input fifo high water */
  177. #define GF3_SR_FILW    0x1000        /* input fifo low water */
  178. #define GF3_SR_GCW    0x0800        /* GC waiting for regfile (assert low)*/
  179. #define GF3_SR_NST    0x0400        /* fifo nesting error (assert low) */
  180. #define GF3_SR_INT    0x0200        /* internal init (assert low) */
  181. #define GF3_SR_HLT    0x0100        /* GM 68020 halted (assert low) */
  182.  
  183. #define GF3_CR_HEN    0x0040        /* high water enable interrupt */
  184. #define GF3_CR_IGM    0x0020        /* interrupt the GM 020 */
  185. #define GF3_CR_RST    0x0010        /* reset bit (asserted low) */
  186. #define GF3_CR_IEN    0x0008        /* interrupt enable */
  187. #define GF3_CR_INT7    0x0007        /* interrupt on level 7 */
  188. #define GF3_CR_INT6    0x0006        /* interrupt on level 6 */
  189. #define GF3_CR_INT5    0x0005        /* interrupt on level 5 */
  190. #define GF3_CR_INT4    0x0004        /* interrupt on level 4 */
  191. #define GF3_CR_INT3    0x0003        /* interrupt on level 3 */
  192. #define GF3_CR_INT2    0x0002        /* interrupt on level 2 */
  193. #define GF3_CR_INT1    0x0001        /* interrupt on level 1 */
  194. #define GF3_CR_INT0    0x0000        /* interrupt on level 0 */
  195.  
  196. /*
  197.  * the normal mode for the GF3 is not reset, enable vme interrupts at the 
  198.  * given level
  199.  */
  200. #define CR_STATE (GF3_CR_RST | GF3_CR_IEN | GF3_INTLEVEL | GF3_CR_HEN )
  201. /* Interrupt Vector register (vector provided VME interrupt) */
  202.  
  203. #define    GF3_RESET_DELAY    30        /* microseconds */
  204.  
  205. #define GF3_VEC_A16    0x2000
  206.  
  207. /* Interrupt on level 6 with vector 0x40 (sync with vme.c) */
  208. #define GF3_INTLEVEL    GF3_CR_INT6
  209. #define GF3_INTVEC    0x40
  210.  
  211. #define GRO_FIFO_TIMEOUT    500    /* spin fifo full timeout */
  212.  
  213. #define    GROWAIT_TIMEOUT        0x1
  214. #define    GROWAIT_FLUSHPIPE    0x2
  215. #define    GROWAIT_RTNBUF        0x4
  216.  
  217. #define GRO_REGION_SIZE         3    /* GE, shmem, csr */
  218.  
  219.  
  220. /*
  221.  * GM prom interface definitions.  This is the interface
  222.  * definitions between the host and the GM when the GM is running at
  223.  * the prom level.  The structure resides at low end of core.
  224.  *
  225.  */
  226.  
  227. /*
  228.  * This is the starting PC of the GM microcode.
  229.  */
  230. #define    GM_ENTRY    0x1004000
  231.  
  232. /*
  233.  * Water mark for FE GA
  234.  */
  235. #define DEFAULTWATER    0x3626    
  236.  
  237. /*
  238.  * This structure is at the beginning of the GM memory.  It is used to
  239.  * communicate between the host and the GM proms.
  240.  */
  241. #define    BOOT_CBUFSIZE    32        /* never ever ever ever ever change */
  242. struct    gmprom_hdr {
  243.     long    magic;            /* flag controlling boot process */
  244.     long    (*pc)();        /* starting pc for downloaded code */
  245.     long    havedebug;        /* true if we have the debug board */
  246.     long    drawlogo;        /* true if we should draw sgi logo */
  247.                     /* also used for 30/60Hz support */
  248.     long    handshake;        /* used for handshake test or argument 
  249.                        to a downloaded program */
  250.     struct gmprom_cbuf {
  251.         char c[BOOT_CBUFSIZE];
  252.     } c;                /* 32 characters for printing */
  253. #ifdef INPROM
  254.     struct    textport tport;        /* the textport data structures */
  255. #endif
  256. };
  257.  
  258. /*
  259.  * When the proms go into boot state, the load the following value into
  260.  * long word 0 in the shared dynamic memory.
  261.  * Once the proms load this value into dynamic ram, they wait for it
  262.  * to change.  
  263.  */
  264. #define    BOOT_MAGIC0    0xAAAAAAAA
  265.  
  266. /*
  267.  * Once the host completes the download into the GM's memory,
  268.  * it stores the value below into the same cell signalling to the proms
  269.  * that the download is complete.
  270.  */
  271. #define    BOOT_MAGIC1    0x55555555
  272.  
  273. /*
  274.  * When the host wishes to print something using the GM, it writes
  275.  * the magic value below into memory, and places up to 32 characters
  276.  * into the array defined above.
  277.  */
  278. #define    BOOT_MAGIC2    0xCCCCCCCC
  279.  
  280. /*
  281.  * If the host wishes to reset the graphics display, it issues this
  282.  * call.
  283.  */
  284. #define    BOOT_MAGIC3    0xDDDDDDDD
  285.  
  286. /*
  287.  * The host uses this command to test for the GF3 running this prom
  288.  * software.  If the handshake is answered properly then the host can
  289.  * assume that the GF3 is in a sane state and doesn't need reseting.
  290.  */
  291. #define    BOOT_MAGIC4    0xEEEEEEEE
  292. #define    BOOT_HANDSHAKE    0xDEADBEEF
  293.  
  294. #define    GMPROM_HDR_DRAWLOGO    0xBEEDCEED
  295.  
  296. /*
  297.  * For some machines, the logo should not be drawn.  Therefore, we assume
  298.  * we should not draw it unless gmprom_hdr.drawlogo is set to this
  299.  * magic value (or combined (in sum) with the 30Hz magic). =>
  300.  * 0x0: no logo, 60Hz,
  301.  * 0xdead: no logo, 30 Hz
  302.  * 0xBEEDCEED: logo, 60Hz
  303.  * 0xBEEDCEED + 0xdead: logo, 30Hz
  304.  */
  305. #define    GMPROM_HDR_DRAWLOGO    0xBEEDCEED
  306.  
  307. #define MONITOR_60HZ             0x00000000
  308. #define MONITOR_30HZ             0x00000001
  309. #define MONITOR_NTSC             0x00000002
  310. #define MONITOR_PAL             0x00000003
  311. #define MONITOR_343            0x00000004
  312. #define MONITOR_NO_SYNC_ON_GREEN    0x00000010
  313. #define MONITOR_GENLOCK            0x00000020
  314.  
  315. #endif /* _KERNEL */
  316.  
  317. #endif /* __SYS_GRO_H__ */
  318.